<?php
set_time_limit(0);
include('audio/class.audio_streamer.php');
if (isset($_GET["path"])) {
	$_GET["path"] = str_replace("..", "", $_GET["path"]);
	if (!strstr($_GET["path"], 'AUDIO_PATH/')) {
		header("HTTP/1.0 404 Not Found"); die();
	}
	include("conf.php");
	$fullImagePath = str_replace('AUDIO_PATH/', AUDIO_PATH, $_GET["path"]);
	$originalFileName = array_reverse(explode("/", $fullImagePath));
	if (!file_exists("mp3_audio/".$originalFileName[0]) || filemtime($fullImagePath) > filemtime("mp3_audio/".$originalFileName[0])) {
		$sound = new audio_streamer($fullImagePath); //WAV asukoht, lame(.exe) asukoht
		$sound->save("mp3_audio"); //mp3 salvestamise koht
	}
}
?>